@echo off
setlocal enabledelayedexpansion

set PATH=%PATH%;%~dp0KlWinEnvSetup\usr\bin

IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
    reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0>nul 2>nul
    if %errorlevel% neq 0 (%~dp0vc_redist.x86 /quiet)
) ELSE (
    reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0>nul 2>nul
    if %errorlevel% neq 0 (%~dp0vc_redist.x64 /quiet)
)

bash %*